getApp();

Page({
    data: {
        rename: "",
        generated: ""
    },
    rename: function(t) {
        this.setData({
            rename: t.detail.value
        });
    },
    generate: function() {
        var t = this;
        wx.request({
            url: "https://rename.yiqiubiji.com/api/rename",
            method: "post",
            dataType: "json",
            data: {
                rename: t.data.rename
            },
            success: function(e) {
                1 == e.data.code ? (t.setData({
                    generated: e.data.data
                }), wx.showToast({
                    title: "生成成功"
                })) : wx.showToast({
                    title: "生成无效",
                    icon: "none",
                    duration: 2e3,
                    mask: !0
                });
            }
        });
    },
    copytext: function(t) {
        wx.setClipboardData({
            data: t.currentTarget.dataset.text,
            success: function(t) {
                wx.getClipboardData({
                    success: function(t) {
                        wx.showToast({
                            title: "复制成功"
                        });
                    }
                });
            }
        });
    }
});